<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<!--框架必需start-->
<script type="text/javascript" src="../../libs/js/jquery.js"></script>
<script type="text/javascript" src="../../libs/js/language/cn.js"></script>
<script type="text/javascript" src="../../libs/js/framework.js"></script>
<link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" id="skin" prePath="../../"/>
<link rel="stylesheet" type="text/css" id="customSkin"/>
<!--框架必需end-->

<!--树形表格start-->
<script type="text/javascript" src="../../libs//js/table/treeTable.js"></script>
<!--树形表格end-->
</head>
<body>
 <div class="page_content">


			<div class="groupTitle"><span>1、基本用法</span></div>
			
<table class="treeTable">
	<tr>
		<th width="250">名称</th>
		<th width="120">大小</th>
		<th>备注</th>
	</tr>
	<tr id="node-1">
		<td><span class="folder">根目录1</span></td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-2" class="child-of-node-1">
		<td><span class="folder">二级目录1</span></td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-8" class="child-of-node-2">
		<td><span class="file">文件1</span></td>
		<td>52 KB</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-9" class="child-of-node-2">
		<td><span class="file">文件2</span></td>
		<td>4 KB</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-3" class="child-of-node-1">
		<td><span class="file">文件3</span></td>
		<td>4 KB</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-4" class="child-of-node-1">
		<td><span class="folder">二级目录2</span></td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-5" class="child-of-node-4">
		<td><span class="file">文件4</span></td>
		<td>56 KB</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-14">
		<td><span class="file">文件5</span></td>
		<td>4 KB</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-11">
		<td><span class="folder">根目录2</span></td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-12" class="child-of-node-11">
		<td><span class="file">文件6</span></td>
		<td>4 KB</td>
		<td>备注说明</td>
	</tr>
</table>		

	  <div class="height_15"></div>
	  


			<div class="groupTitle"><span>2、不使用图标</span></div>
			
如果不希望有文件夹和文件的图标，去掉td中的span。
<table class="treeTable">
	<tr>
		<th width="250">名称</th>
		<th width="120">大小</th>
		<th>备注</th>
	</tr>
	<tr id="node-1">
		<td>根目录1</td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-2" class="child-of-node-1">
		<td>二级目录1</td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-8" class="child-of-node-2">
		<td>文件1</td>
		<td>52 KB</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-9" class="child-of-node-2">
		<td>文件2</td>
		<td>4 KB</td>
		<td>备注说明</td>
	</tr>
</table>			

	  <div class="height_15"></div>
	  


			<div class="groupTitle"><span>3、不可收缩</span></div>
			
为table添加expandable属性可设置是否可展开/闭合。下面的是一个不可收缩的树形表格
<table class="treeTable" expandable="false">
	<tr>
		<th width="250">名称</th>
		<th width="120">大小</th>
		<th>备注</th>
	</tr>
	<tr id="node-1">
		<td><span class="folder">根目录1</span></td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-2" class="child-of-node-1">
		<td><span class="folder">二级目录1</span></td>
		<td>--</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-8" class="child-of-node-2">
		<td><span class="file">文件1</span></td>
		<td>52 KB</td>
		<td>备注说明</td>
	</tr>
	<tr id="node-9" class="child-of-node-2">
		<td><span class="file">文件2</span></td>
		<td>4 KB</td>
		<td>备注说明</td>
	</tr>
</table>
另外table如果设置initState="collapsed"	则初始时树形表格处于收缩状态。			

	  <div class="height_15"></div>
	  


			<div class="groupTitle"><span>4、ajax模式</span></div>
			
	<table class="treeTable" ajaxMode="true">
		<tr>
			<th width="250">名称</th>
			<th width="120">大小</th>
			<th>备注</th>
		</tr>
		<tr id="ajaxnode-1" url="../../sample_html/table/data/table3.html">
			<td><span class="folder">根目录1</span></td>
			<td>--</td>
			<td>备注说明</td>
		</tr>
		<tr id="ajaxnode-14">
			<td><span class="file">文件5</span></td>
			<td>4 KB</td>
			<td>备注说明</td>
		</tr>
		<tr id="ajaxnode-11" url="../../sample_html/table/data/table4.html">
			<td><span class="folder">根目录2</span></td>
			<td>--</td>
			<td>备注说明</td>
		</tr>
	</table>			

	  <div class="height_15"></div>
	  


			
	  


			<div class="groupTitle"><span>5、动态创建</span></div>
			
			<input type="button" value="点击创建" id="testBtn" onclick="createTreeTable()" class="default"/>
	

	  <div class="height_15"></div>
	  
	  
</div>	
<script>
	function viewCheckIds(){
		var msg="";
		$("#mytable input[type=checkbox]").each(function(){
			if($(this).attr("checked")){
				msg=msg+","+$(this).parents("tr").attr("id")
			}
		})
		if(msg==""){
			msg="无选择"
		}
		top.Toast("showNoticeToast", msg);
	}
	
	function createTreeTable(){
		var $tableObj=$('<table class="treeTable" ajaxMode="true">'+
			'<tr>'+
				'<th width="250">名称</th>'+
				'<th width="120">大小</th>'+
				'<th>备注</th>'+
			'</tr>'+
			'<tr id="ajaxnode-1" url="data/table3.html">'+
				'<td><span class="folder">根目录1</span></td>'+
				'<td>--</td>'+
				'<td>备注说明</td>'+
			'</tr>'+
			'<tr id="ajaxnode-11" url="data/table4.html">'+
				'<td><span class="folder">根目录2</span></td>'+
				'<td>--</td>'+
				'<td>备注说明</td>'+
			'</tr>'+
		'</table>');
		$tableObj.render();
		$("#testBtn").after($tableObj);
	}
</script>
</body>
</html>